<?php
require_once ('../lib/config.php');
require_once ('../lib/facebook.php');
require_once ('../lib/friends.php');
require_once ('../lib/friend.php');
require_once ('../lib/test.php');
require_once ('../../simpletest/autorun.php');
require_once ('../lib/init.php');

class TestTemplate extends UnitTestCase {
    
    function setUp(){
//        global $login_button;
//        try{
//        $me = getOneself();
//        }catch(Exception $e){
//            print($login_button);
//            exit();
//        }
    }
    
    //refer to http://www.simpletest.org/en/unit_test_documentation.html
    function testProcessMyNoteComments(){ 
    
        $friends = array();
        $comments = array (
            'name' => 'myCommentNoteQuery',
            'fql_result_set' => 
            array (
              0 => 
              array (
                'uid' => '15720738',
              ),
              1 => 
              array (
                'uid' => '1128757552',
              ),
              2 => 
              array (
                'uid' => '100000416787478',
              ),
            ),
          );

        
        processMyComments2($friends, $comments);
        
        $this->assertNotNull($friends);
        $this->assertFalse(empty($friends));
        $this->assertTrue(count($friends) == 3);
    }
    
    function testProcessMyLinkComments(){ 
    
        $friends = array();
        $comments =   array (
            'name' => 'myCommentLinkQuery',
            'fql_result_set' => 
            array (
              0 => 
              array (
                'owner' => '15720738',
              ),
              1 => 
              array (
                'owner' => '645061280',
              ),
              2 => 
              array (
                'owner' => '711806955',
              ),
              3 => 
              array (
                'owner' => '732486215',
              ),
              4 => 
              array (
                'owner' => '1382591304',
              ),
              5 => 
              array (
                'owner' => '1468604886',
              ),
              6 => 
              array (
                'owner' => '1468604886',
              ),
              7 => 
              array (
                'owner' => '100000525262538',
              ),
              8 => 
              array (
                'owner' => '100001442696712',
              ),
            ),
          );
        
        processMyComments2($friends, $comments);
        
        $this->assertNotNull($friends);
        $this->assertFalse(empty($friends));
        $this->assertTrue(count($friends) == 8);
        //$this->assertTrue($friends['1468604886'])
        print_r($friends);
    }
    
    function testProcessMyStatusComments(){ 
    
        $friends = array();
        $comments = array (
            'name' => 'myCommentStatusQuery',
            'fql_result_set' => 
            array (
              0 => 
              array (
                'uid' => '550118413',
              ),
              1 => 
              array (
                'uid' => '534124579',
              ),
              2 => 
              array (
                'uid' => '612139051',
              ),
            ),
          );
        
        processMyComments2($friends, $comments);
        
        $this->assertNotNull($friends);
        $this->assertFalse(empty($friends));
        $this->assertTrue(count($friends) == 3);
    }
}
?>
